﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Calendar/Calendar.master" AutoEventWireup="true" CodeBehind="ManageEvent.aspx.cs" Inherits="HRdex_Final.Calendar.WebForm4" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div align="center">
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AutoGenerateColumns="False" BackColor="White" BorderColor="#CCCCCC" 
            BorderStyle="None" BorderWidth="1px" CellPadding="3" DataKeyNames="EventID" 
            DataSourceID="SqlDataSource1" Width="702px">
            <Columns>
                <asp:BoundField DataField="EventID" HeaderText="EventID" InsertVisible="False" 
                    ReadOnly="True" SortExpression="EventID" Visible="False" />
                <asp:BoundField DataField="date" DataFormatString="{0:MM/dd/yyyy}" 
                    HeaderText="Date" HtmlEncode="False" SortExpression="date">
                <ItemStyle Width="90px" />
                </asp:BoundField>
                <asp:BoundField DataField="Title" HeaderText="Event Title" 
                    SortExpression="Title">
                <ItemStyle Width="200px" />
                </asp:BoundField>
                <asp:BoundField DataField="Description" HeaderText="Details" 
                    SortExpression="Description" />
                <asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" 
                    SortExpression="EmployeeID" Visible="False" />
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True">
                <ItemStyle Width="50px" />
                </asp:CommandField>
            </Columns>
            <FooterStyle BackColor="White" ForeColor="#000066" />
            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
            <RowStyle ForeColor="#000066" />
            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#007DBB" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#00547E" />
        </asp:GridView>



        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConflictDetection="CompareAllValues" 
            ConnectionString="<%$ ConnectionStrings:HRmainConnectionString %>" 
            DeleteCommand="DELETE FROM [catEvent] WHERE [EventID] = @original_EventID AND [date] = @original_date AND [Title] = @original_Title AND [Description] = @original_Description AND (([EmployeeID] = @original_EmployeeID) OR ([EmployeeID] IS NULL AND @original_EmployeeID IS NULL))" 
            InsertCommand="INSERT INTO [catEvent] ([date], [Title], [Description], [EmployeeID]) VALUES (@date, @Title, @Description, @EmployeeID)" 
            OldValuesParameterFormatString="original_{0}" 
            SelectCommand="SELECT * FROM [catEvent] ORDER BY [date]" 
            
            UpdateCommand="UPDATE [catEvent] SET [date] = @date, [Title] = @Title, [Description] = @Description, [EmployeeID] = @EmployeeID WHERE [EventID] = @original_EventID AND [date] = @original_date AND [Title] = @original_Title AND [Description] = @original_Description AND (([EmployeeID] = @original_EmployeeID) OR ([EmployeeID] IS NULL AND @original_EmployeeID IS NULL))">
            <DeleteParameters>
                <asp:Parameter Name="original_EventID" Type="Int32" />
                <asp:Parameter Name="original_date" Type="DateTime" />
                <asp:Parameter Name="original_Title" Type="String" />
                <asp:Parameter Name="original_Description" Type="String" />
                <asp:Parameter Name="original_EmployeeID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="date" Type="DateTime" />
                <asp:Parameter Name="Title" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="EmployeeID" Type="Int32" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="date" Type="DateTime" />
                <asp:Parameter Name="Title" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="EmployeeID" Type="Int32" />
                <asp:Parameter Name="original_EventID" Type="Int32" />
                <asp:Parameter Name="original_date" Type="DateTime" />
                <asp:Parameter Name="original_Title" Type="String" />
                <asp:Parameter Name="original_Description" Type="String" />
                <asp:Parameter Name="original_EmployeeID" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>

    </div>
</asp:Content>
